/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */
'use strict';
import React, {
    Component,
} from 'react';

import {
    StyleSheet,
    Text,
    View,
    Image,
    TouchableHighlight,
    NetInfo,
    Dimensions,
    Alert
} from 'react-native';

import {Actions,ActionConst} from 'react-native-router-flux';
import CommonStyles from '../styles/common';
import {Button,WhiteSpace} from 'antd-mobile';

export default class Main extends Component {
    constructor (props) {
      super(props)
    }

    onClickToScanBarCode(){
        Actions.scanBarCode();
    }

    onClickToActions(key){
        if (Actions[key]){
            Actions[key]();
        }else{
            Alert.alert('系统提示','未找到该页面');
        }
    }

    render() {
      return (
        <View style={[CommonStyles.container,CommonStyles.flexHCenter,CommonStyles.padding10]}>
            <Button type='ghost' onClick={()=>this.onClickToActions('scanBarCode')}>扫码</Button>
            <WhiteSpace size='md' />
            <Button type='ghost' onClick={()=>this.onClickToActions('imageUpload')}>图片上传</Button>    
        </View>
      );
    }
}
